import config from 'config'
import httpFetch from 'share/httpFetch'
import errorMessage from 'share/errorMessage';
import {messages,getTime} from "share/common";
import { Modal, Button } from 'antd';

export default {
  freeTrailInfo() {
    Modal.info({
      title: <div className="free-trail-info-title-wrap">
        <div className="free-trail-info-title-tip">{messages('login.key40')/*您已进入*/}</div>
        <div className="free-trail-info-title">{messages('login.key41')/*模拟演示账号*/}</div>
      </div>,
      content: (
        <div className="free-trail-info-content-wrap">
          <div className="free-trail-info-content1">{messages('login.key42')/*该账号中预设了一些演示数据，您可以在此基础上进行操作，希望可以帮助您更好的了解汇联易。*/}</div>
          <div className="free-trail-info-content2">{messages('login.key43')/*温馨提示：体验企业并非正式企业，请不要使用企业真实数据和信息，以防信息泄露，谢谢配合，祝您体验愉快！*/}</div>
        </div>
      ),
      onOk() {
        window.sessionStorage.setItem("isShowTrailTip","true");
      },
    });
  },
  //获取图片验证码
  getVerifyCodeImage() {
    return new Promise((resolve, reject) => {
      httpFetch.get(`${config.baseUrl}/api/companies/register/verify/code?time=${getTime()}`,{},{
        "Cache-Control": "no-cache", "Pragma": "no-cache", "Expires": -1
      })
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          errorMessage(err.response);
          reject(err);
        })
    })
  },
  //免费体验，验证图片验证码，验证手机号，并获取手机验证码
  sendPhoneToken(params) {
    // let params={
    //   mobile:"",
    //   verifyCode:""
    //   attachmentOID:""
    // }
    return new Promise((resolve, reject) => {
      httpFetch.get(`${config.baseUrl}/api/trialService/ft/mobile/token`,params)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          errorMessage(err.response);
          reject(err);
        })
    })
  },
  //验证手机与验证码
  bandPhoneToken(params) {
    // let params={
    //   mobile:"",
    //   token:""
    // }
    return new Promise((resolve, reject) => {
      httpFetch.get(`${config.baseUrl}/api/trialService/ft/mobile/token/check`,params)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          errorMessage(err.response);
          reject(err);
        })
    })
  },

}
